//
//  Color+Extensions.swift
//  RssFly
//
//  Created by shen on 2023/10/17.
//

import SwiftUI

public extension Color {
    func hexString(environment: EnvironmentValues) -> String {
        let resolvedColor = resolve(in: environment)

        return String(
            format: "#%02lX%02lX%02lX%02lX",
            lroundf(resolvedColor.red * 255),
            lroundf(resolvedColor.green * 255),
            lroundf(resolvedColor.blue * 255),
            lroundf(resolvedColor.opacity * 255)
        )
    }
}
